Message Categorizer

Message Categorizer

This was a piece that I am pretty proud of

Initially, this was a single json file that map a dot-notation (i.e: Personal.BlogPost.Resume) to a json object that contain functional data transformation, allow consistent message schema get publish to downstream services.

Clearly a single json file that hold logic is not scalable so we need to break it down for modularity. We also would want it make it as frictionless as possible to include new type of category

Introducing EventTypeProcessors

This is a module within lambda layer, allowing to create each category as a .js file. all the Processors will then get rolled up into a single json reference file, allowing access to category transformer

Here is the module for the code

Roll up logic

Constaints

There are some constraint to each message category:

  • Category must be capitalize. This would allow non-capitalize file to be used as helper file
  • File and Folder must not share the same name in same level

Example

Message Categorizer